package com.wu.dms.controller;

import com.wu.common.convertion.result.Result;
import com.wu.common.convertion.result.Results;
import com.wu.dms.dto.AdminRequestDTO;
import com.wu.dms.service.AdminService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * 后台管理的相关事宜
 */
@RestController()
@RequiredArgsConstructor
@RequestMapping("/admin")
public class AdminController {

    private final AdminService adminService;

    // 判断是否登录成功
    @PostMapping("/login/status")
    public Result<Boolean> loginStatus(@RequestBody AdminRequestDTO adminRequestDTO, HttpSession session) {
        adminService.verityPasswd(adminRequestDTO, session);
        return Results.success(true);
    }
}
